.class public Lcom/glympse/platform/GBitmap;
.super Ljava/lang/Object;
.source "GBitmap.java"


# static fields
.field public static final COMPRESS_JPG:I = 0x0

.field public static final COMPRESS_PNG:I = 0x1


# instance fields
.field public m_oBitmap:Landroid/graphics/Bitmap;


# direct methods
.method public constructor <init>(Landroid/graphics/Bitmap;)V
    .locals 1
    .parameter "oBitmap"

    .prologue
    .line 28
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    .line 25
    const/4 v0, 0x0

    iput-object v0, p0, Lcom/glympse/platform/GBitmap;->m_oBitmap:Landroid/graphics/Bitmap;

    .line 30
    iput-object p1, p0, Lcom/glympse/platform/GBitmap;->m_oBitmap:Landroid/graphics/Bitmap;

    .line 31
    return-void
.end method


# virtual methods
.method public GetBytes(II)[B
    .locals 7
    .parameter "eCompressType"
    .parameter "nQuality"

    .prologue
    const/4 v5, 0x0

    .line 36
    move-object v0, v5

    check-cast v0, [B

    move-object v1, v0

    .line 38
    .local v1, abBytes:[B
    iget-object v6, p0, Lcom/glympse/platform/GBitmap;->m_oBitmap:Landroid/graphics/Bitmap;

    if-nez v6, :cond_1

    .line 74
    :cond_0
    :goto_0
    return-object v5

    .line 44
    :cond_1
    if-nez p1, :cond_2

    .line 46
    sget-object v3, Landroid/graphics/Bitmap$CompressFormat;->JPEG:Landroid/graphics/Bitmap$CompressFormat;

    .line 60
    .local v3, eCompressFormat:Landroid/graphics/Bitmap$CompressFormat;
    :goto_1
    :try_start_0
    new-instance v4, Ljava/io/ByteArrayOutputStream;

    invoke-direct {v4}, Ljava/io/ByteArrayOutputStream;-><init>()V

    .line 61
    .local v4, oOutputStream:Ljava/io/ByteArrayOutputStream;
    iget-object v5, p0, Lcom/glympse/platform/GBitmap;->m_oBitmap:Landroid/graphics/Bitmap;

    invoke-virtual {v5, v3, p2, v4}, Landroid/graphics/Bitmap;->compress(Landroid/graphics/Bitmap$CompressFormat;ILjava/io/OutputStream;)Z

    .line 64
    invoke-virtual {v4}, Ljava/io/ByteArrayOutputStream;->toByteArray()[B

    move-result-object v1

    .line 67
    invoke-virtual {v4}, Ljava/io/ByteArrayOutputStream;->close()V
    :try_end_0
    .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0

    .end local v4           #oOutputStream:Ljava/io/ByteArrayOutputStream;
    :goto_2
    move-object v5, v1

    .line 74
    goto :goto_0

    .line 48
    .end local v3           #eCompressFormat:Landroid/graphics/Bitmap$CompressFormat;
    :cond_2
    const/4 v6, 0x1

    if-ne v6, p1, :cond_0

    .line 50
    sget-object v3, Landroid/graphics/Bitmap$CompressFormat;->PNG:Landroid/graphics/Bitmap$CompressFormat;

    .restart local v3       #eCompressFormat:Landroid/graphics/Bitmap$CompressFormat;
    goto :goto_1

    .line 69
    :catch_0
    move-exception v5

    move-object v2, v5

    .line 71
    .local v2, e:Ljava/lang/Exception;
    invoke-static {v2}, Lcom/glympse/platform/common/Helpers;->Log(Ljava/lang/Throwable;)V

    goto :goto_2
.end method
